#include "main.h"
#include "main_file.h"
#include "linux_timer.h"
Ltimer* timer;
/**
 * @brief 回调函数
 * 
 * @param data 
 */
static void timer_callback(unsigned long data){
    static unsigned long last = 0;
    printk("timer callback =%d\r\n",jiffies_to_msecs(jiffies- last));
    last = jiffies;
}


int __init timer_init(void)
{
    timer =   InitTimer(timer_callback,NULL,1000);
    printk("timer = %xd data = %d\r\n",(unsigned int)timer,jiffies_to_msecs(timer->timer));
    startTimer(timer);
    return 0; 
}

void __exit timer_exit(void)
{
    freeTimer(timer);
    printk("exit timer\r\n");
}
module_init(timer_init);
module_exit(timer_exit);
MODULE_LICENSE("GPL"); //本驱动程序遵循GPL开源协议，必写
MODULE_AUTHOR("xqyr");
